#include<iostream>
using namespace std;
typedef struct LinkNode
{
	int data;
	struct LinkNode* next;
}Node;
Node* ReserveList(Node** head)
{
	Node* Reserve = NULL;
	Node* cur = *head;
	Node* pre = NULL;
	Node* next_1 = NULL;
	while (cur != NULL){
		next_1 = cur->next;
		if (next_1 == NULL) {
			Reserve = cur;
		}
		cur->next = pre;
		pre = cur;
		cur = next_1;
	}
	return Reserve;
}
void Init_Link(Node** head)
{
	*head = new Node;
	(*head)->data = 0;
	(*head)->next = NULL;
}
void Tail_Insert_Link(Node** head, int arr[], int sz)
{
	Node* tail = *head;
	for (int i = 0; i < sz; i++) {
		Node* temp = new Node;
		temp->data = arr[i];
		temp->next = NULL;
		tail->next = temp;
		tail = temp;
	}
}
void Print_Link(Node* head)
{
	Node* p = head;
	while (p) {
		cout << p->data << " ";
		p = p->next;
	}
	cout << endl;
}
int main()
{
	Node* head;
	Init_Link(&head);
	int arr[] = { 1,2,3,4,5,6,7,8 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	Tail_Insert_Link(&head, arr, sz);
	head = ReserveList(&head);
	Print_Link(head);
	return 0;
}